Skip to main content

Write to CSV

AutomatR.DefaultActivities.CSV.WriteCSV

The "Write to CSV" activity in AutomatR is part of the CSV activities package, designed to facilitate the writing of specific data, extracted from other activities, to a CSV file. This activity provides flexibility by allowing users to define the delimiter, file path, and other optional settings, making it a versatile tool for managing data in CSV format within automation workflows.

Properties

NameDescription
Input
DataSpecifies the DataTable variable reference containing the data to be written to the CSV file. DataTable variables referencing data from other activities, such as "Read CSV."
DelimiterSpecifies the delimiter used in the CSV file (e.g., Tab, Comma(,), Semicolon(;), Caret(^), or Pipe(I)). Char variables containing the desired delimiter.
File PathSpecifies the full path of the CSV file on the local drive, including the filename (e.g., "C:\excelActivities\workbook.csv"). String variables containing the file path.
Include HeadersWhen enabled, considers the column headers as the first row during the write operation. Boolean variables determining whether to include headers.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variables containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Write to CSV" activity. This can be useful for handling synchronization issues. Integer variables containing the delay duration. Ex.: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.
Output
ResultOutputs the result of the "Write to CSV" operation, indicating whether the write operation was successful or encountered any errors. Variables of relevant types (e.g., Boolean variables) to store the operation result.

How to use:

  1. Drag and drop the "Write to CSV" activity onto the workflow.
  2. Configure the properties by specifying the delimiter, file path, and other optional settings.
  3. Provide the DataTable variable reference containing the data to be written.
  4. Optionally, configure the delay.
  5. Execute the workflow to write data to the specified CSV file.

Example: Consider an example where the "Write to CSV" activity is used to write data to a CSV file:

Write to CSV:
File Path: "C:\example\output.csv"
Include Headers: True
Delimiter: ','
Data: dataToWrite
Result: isWriteSuccessful

In this example, the activity writes data from the "dataToWrite" DataTable variable to the "output.csv" file located at "C:\example\". It includes headers, uses a comma as the delimiter, and stores the result of the operation (success or failure) in the Boolean variable "isWriteSuccessful" for further handling in the workflow.